const express = require('express');
const multer = require('multer');
const fileController = require('../controllers/fileController');

const router = express.Router();

// 配置multer中间件用于处理文件上传
const upload = multer({
  storage: multer.memoryStorage(),
  limits: {
    fileSize: 5 * 1024 * 1024, // 限制文件大小为5MB
  },
});

// 文件上传路由
router.post('/upload', upload.single('file'), fileController.uploadFile);

// 文件删除路由
router.delete('/:fileId', fileController.deleteFile);

module.exports = router;